package com.vanzo.tisen.agingtest.activity;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.util.Log;
import android.view.View;

import com.vanzo.tisen.agingtest.AgingApplication;
import com.vanzo.tisen.agingtest.SharedString;

import java.util.ArrayList;

/**
 * Created by tisen on 2017/8/15.
 */

public class BootBroadcastReceiver extends BroadcastReceiver {
    private static final String TAG = "BootBroadcastReceiver";

    @Override
    public void onReceive(Context context, Intent intent) {
        Log.d(TAG, intent.toString());
        SharedPreferences sharedPreferences = context.getSharedPreferences(SharedString.SHARE_NAME, Context.MODE_PRIVATE);
        Log.d(TAG, "Aging_running = " + sharedPreferences.getBoolean(SharedString.AGING_RUNNING, false));
        Log.d(TAG, "Aging_time = " + sharedPreferences.getLong(SharedString.AGING_TIME, 120));
        Log.d(TAG, "Round_time = " + sharedPreferences.getLong(SharedString.ROUND_TIME, 20));
        Log.d(TAG, "Has_reboot = " + sharedPreferences.getBoolean(SharedString.HAS_REBOOT, false));
        Log.d(TAG, "Is_camera = " + sharedPreferences.getBoolean(SharedString.IS_CAMERA, false));
        Log.d(TAG, "Is_front_camera = " + sharedPreferences.getBoolean(SharedString.IS_FRONT_CAMERA, false));
        Log.d(TAG, "Is_reboot = " + sharedPreferences.getBoolean(SharedString.IS_REBOOT, false));
        Log.d(TAG, "Is_lcd = " + sharedPreferences.getBoolean(SharedString.IS_LCD, false));
        Log.d(TAG, "Is_speaker = " + sharedPreferences.getBoolean(SharedString.IS_SPEAKER, false));
        if (sharedPreferences.getBoolean(SharedString.AGING_RUNNING, false)) {
            Intent intent1 = new Intent(context, AgingTestBegin.class);
            intent1.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
            context.startActivity(intent1);
        }
    }
}
